<!DOCTYPE html>
<html>
<head>
<title>任务</title>
<meta name="Keywords" content="关键字">
<meta name="Description" content="内容">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
<meta content="no-cache,must-revalidate" http-equiv="Cache-Control">
<meta content="telephone=no, address=no" name="format-detection">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta content="no-cache" http-equiv="pragma">
<meta content="0" http-equiv="expires">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/style.css" media="all"> 
<script type="text/javascript" src="__PUBLIC__/home/js/jquery-1.9.1.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__/home/js/size.js"></script>
</head>
<body>
<header class="header">
    <div class="box">
        <div class="hleft"><a href="#" onClick="javascript :history.back(-1);" class="tgoto"></a></div>
        <h1>任务</h1>
        <div class="hright"> </div>
    </div>
</header>
<div class="taskform">
    <div class="title frame"><h3>{$data['name']}</h3></div>
    <ul class="flexlist frame">
        <li>
            <i class="ico-date ico"></i>
            <div class="t">{$data['end_time'] | date='Y-m-d H:i',###} 截止</div>
        </li>
        <li>
            <i class="ico-execute ico"></i>
            <div class="t">执行人：{$data['follow_user_name']}</div>
        </li>
        <li>
            <i class="ico-order ico"></i>
            <div class="t">下单人：{$data['input_user_name']}</div>
             
        </li>
    </ul>
    
    <?php
        $user_id = session("user_id");
        $bool = in_array($user_id, explode(',', $data['follow_user_id']));
    ?>

    <div class="frame radiobox">
        <div class="t">是否完成：</div>
        <if condition="$data['commit_status'] eq 2">
            <div class="xradio">
                <label><input type="radio" name="radio" value="1" <if condition="$bool neq true">disabled="disabled"</if>>是</label>
                <label><input type="radio" name="radio" value="3" <if condition="$bool neq true">disabled="disabled"</if>>否</label>
                <label><input type="radio" name="radio" value="4" <if condition="$bool neq true">disabled="disabled"</if>>非正常关闭</label>
            </div>
        <else/>
            <if condition="$data['commit_status'] eq 1">是</if>
            <if condition="$data['commit_status'] eq 3">否</if>
            <if condition="$data['commit_status'] eq 4">非正常关闭</if>
        </if>
    </div>
    <div class="frame filebox">
        <div class="t">上传完成凭证:</div>
        <if condition="$data['commit_status'] eq 2 and $bool eq true">
        <div class="xfile">
            <i id="add">+</i>
            <input type="file" id="upFile">
        </div>
        </if>
    </div>
    <div class="frame fileimg">
        <img id="showimg" src="{$base64Img}" alt="">
    </div>
    <if condition="$data['status'] eq 1">
    <div class="frame filebox">
        <div class="t">存档时间：{$data['commit_time'] | date='Y-m-d H:i',###}</div>     
    </div>
    </if>

    <div class="formbtn">
        <ul>
            <if condition="$data['commit_status'] eq 2 and $bool eq true">
            <li><input name="" id="commit" type="button" value="提交并进行存档" class="btn"></li>
            </if>
            <li><input name="" type="button" value="返回" class="btn cancel" onclick="history.go(-1);"></li>
        </ul>
    </div>
    
    <input type="hidden" value="{$data['id']}" id="task_id">
    <input type="hidden" value="" id="base64Img">
</div>
</body>
</html>
<script type="text/javascript" src="__PUBLIC__/home/js/pictureHandle.js"></script>
<script type="text/javascript" src="__PUBLIC__/home/js/tools.js"></script>

<script type="text/javascript">
    $("#commit").click(function(){
        var task_id = $("#task_id").val();
        var base64Img = $("#base64Img").val();
        var status = $("input[name='radio']:checked").val();

        if(!status){
            alert('请确认完成结果');
            return false;
        }

        $.post('commit',{'task_id':task_id,'base64Img':base64Img,'status':status},function(d){
            if(d.status == true){
                location.href="/Home/Index/showList";
                return false;
            }else{
                alert(d.msg);
                return false;
            }
        },"json");
    })

</script>
